package com.lzh.blog.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author liuzhihao
 * @create 2021-10-07 20:38
 * 关于web相关的
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/admin/**") // 过滤
                .excludePathPatterns("/admin") // 排除在外（不用过滤）
                .excludePathPatterns("/admin/login");
    }
}
